import { createRouter, createWebHistory } from "vue-router";

export default createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: '/',
            redirect: '/home',
            meta: {
                title: '首页'
            }
        },
        {
            path: '/home',
            component: () => import('@/views/home/index.vue'),
            name: '首页'
        },
        {
            path: '/wxlogin',
            component: () => import('@/views/wxlogin/index.vue')
        },
        {
            path: '/hospital',
            component: () => import('@/views/hospital/index.vue'),
            name: '医院信息',
            redirect: '/hospital/register',
            children: [
                {
                    path: 'register',
                    component: () => import('@/views/hospital/register/index.vue'),
                    name: '预约挂号'
                },
                {
                    path: 'detail',
                    component: () => import('@/views/hospital/detail/index.vue'),
                    name: '医院详情'
                },
                {
                    path: 'notice',
                    component: () => import('@/views/hospital/notice/index.vue'),
                    name: '预约通知'
                },
                {
                    path: 'close',
                    component: () => import('@/views/hospital/close/index.vue'),
                    name: '停诊信息'
                },
                {
                    path: 'search',
                    component: () => import('@/views/hospital/search/index.vue'),
                    name: '查询/取消'
                },
                {
                    path: 'register_step1',
                    component: () => import('@/views/hospital/register/register_step1.vue'),
                    name: '门诊挂号'
                },
                {
                    path: 'register_step2',
                    component: () => import('@/views/hospital/register/register_step2.vue'),
                    name: '选择就诊人'
                },
            ]
        },
        {
            path: '/user',
            component: () => import('@/views/user/index.vue'),
            name: '会员中心',
            redirect: '/user/certification',
            children: [
                {
                    path: 'certification',
                    component: () => import('@/views/user/certification/index.vue'),
                    name: '实名认证'
                },
                {
                    path: 'feedback',
                    component: () => import('@/views/user/feedback/index.vue'),
                    name: '意见反馈'
                },
                {
                    path: 'order',
                    component: () => import('@/views/user/order/index.vue'),
                    name: '挂号订单'
                },
                {
                    path: 'patient',
                    component: () => import('@/views/user/patient/index.vue'),
                    name: '就诊管理'
                },
                {
                    path: 'add',
                    component: () => import('@/views/user/patient/add/index.vue'),
                    name: '添加就诊人',
                },
                {
                    path: 'detail',
                    component: () => import('@/views/user/patient/detail/index.vue'),
                    name: '就诊人详情',
                },
                {
                    path: 'profile',
                    component: () => import('@/views/user/profile/index.vue'),
                    name: '账号信息'
                }
            ]
        }
    ],
    scrollBehavior() {
        return {
            left: 0,
            top: 0
        }
    }
})